import 'package:flutter/material.dart';

/// 作者: Tao
/// 日期: 2024/1/17
/// 时间: 09:54
/// 描述: 自定义输入框控件
class GSYInputWidget extends StatefulWidget {
  final bool obscureText;
  final String hintText;

  final IconData iconData;

  final ValueChanged<String> onChanged;
  final TextStyle? textStyle;

  final TextEditingController controller;

  const GSYInputWidget(
      {Key? key,
      this.obscureText = false,
      required this.hintText,
      required this.iconData,
      required this.onChanged,
      this.textStyle,
      required this.controller})
      : super(key: key);

  @override
  GSYInputWidgetState createState() => GSYInputWidgetState();
}

class GSYInputWidgetState extends State<GSYInputWidget> {
  @override
  Widget build(BuildContext context) {
    return TextField(
      controller: widget.controller,
      onChanged: widget.onChanged,
      obscureText: widget.obscureText,
      decoration: InputDecoration(
          hintText: widget.hintText, icon: Icon(widget.iconData)),
    );
  }
}
